﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppExtensions.Formatter
{
    //public class TextPlainInputFormatter
    //{
    //    private const string ContentType = "text/plain";

    //    public TextPlainInputFormatter()
    //    {
    //        SupportedMediaTypes.Add(ContentType);
    //    }

    //    public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
    //    {
    //        var request = context.HttpContext.Request;
    //        using (var reader = new StreamReader(request.Body))
    //        {
    //            var content = await reader.ReadToEndAsync();
    //            return await InputFormatterResult.SuccessAsync(content);
    //        }
    //    }

    //    public override bool CanRead(InputFormatterContext context)
    //    {
    //        var contentType = context.HttpContext.Request.ContentType;
    //        return contentType.StartsWith(ContentType);
    //    }
    //}
}
